using BLL;
using DAL;
using IBLL;
using IDAL;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<Mycontext>(p =>
{
    p.UseSqlServer(builder.Configuration.GetConnectionString("conn"));
});
builder.Services.AddScoped(typeof(Base<>));
builder.Services.AddScoped<IMemberDAL,MemDAL>();
builder.Services.AddScoped<IMemberBLL,MemBLL>();


var app = builder.Build();
app.UseCors(p=>p.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
